Skip to main content

Arrays Methods

Setup#

  1. Navigate to the student_examples folder for today.
  2. Create a file called array_methods.js to use for practice code.
  3. Open it in your text editor. Add a console log and run your code to confirm that you can see the output in your terminal.

Lesson Objectives#

  • Use array methods and research more methods on their own

ARRAY METHODS: Adding and Removing Elements#

Activity#

In this lesson we're going to learn how manipulate our arrays. We'll learn how to add items, remove items, do a simple sort and more!

  • Let's make an array together called favMovies and put everyone's favorite movie in there
  • We'll share the array in slack and break off into small groups for about 10 minutes and each group will research and give us an explanation and a code example of the following methods

Methods - each group gets one#

  1. indexOf
  2. push
  3. pop
  4. reverse
  5. unshift
  6. shift
  7. slice
  8. splice
  9. sort